var util = require('../../utils/util.js');
var uid = 0;
Page({
  data: {
      result:[]
  },
  goAtherPage: function(e){
      var url = e.currentTarget.dataset.link;
      wx.navigateTo({url: url})
  },
  onLoad: function(data){
    uid = data.uid || "";
    this.load();
  },
  load:function(){
    var that = this;
    util.api({
        data:{
            publickey:util.publiccode,
            ac:"catalist",
            uid:uid,
            "type":1
        },
        success:function(responseData){
            var result = responseData.data;
            result.forEach(function(m){
                var names = m.name.split("|");
                m.chineseName = names[0];
                m.englishName = names[1];
                m.uid = uid;
            });
            that.setData({
                result:result
            });
        }
    });
  }
})